﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MvcApplication6.DAL;
using MvcApplication6.Models;

namespace MvcApplication6.BIZ
{
    public class EventBIZ
    {
        EventDAL DAL = new EventDAL();

        public List<EventModel> EventSearchTitleById_ce(int idCe)
        {
            try
            {
                List<EventModel> lst = new List<EventModel>();
                lst = DAL.EventSearchTitleById_ce(idCe);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }

        }

        //-------------------EventSearchById-------------------
        public EventModel EventSearchById(int id)
        {
            try
            {
                EventModel lst = new EventModel();
                lst = DAL.EventSearchById(id);

                return lst;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //---------------------EventInsert-----------------------------
        public int EventInsert(int id_ce, string title, string title2, string image, String start_date, String end_date, string content)
        {
            try
            {
                int i = DAL.EventInsert(id_ce, title, title2, image, start_date, end_date, content);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //---------------------EventUpdate-----------------------------
        public int EventUpdate(int id, int id_ce, string title, string title2, string image, String start_date, String end_date, string content)
        {
            try
            {
                int i = DAL.EventUpdate(id, id_ce, title, title2, image, start_date, end_date, content);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }

        //---------------------EventDelete-----------------------------
        public int EventDelete(int id)
        {
            try
            {
                int i = DAL.EventDelete(id);

                return i;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public List<EventModel> EventSearchSale(int flag)
        {
            try
            {
                List<EventModel> lstEvent = DAL.EventSearchSale(flag);

                return lstEvent;
            }
            catch (Exception)
            {
                throw;
            }
        
        
        }
    }
}